<?php


namespace App\Models;


class LessonSection extends Model
{
    protected $table = 'lesson_sections';

    protected $fillable = ['lesson_id', 'section', 'metadata', 'sources'];


    const SECTION = [
        'dub' => 'dub',
        'essence' => 'essence',
        'read' => 'read',
        'word' => 'word',
        'game' => 'game'
    ];

    // ============= scope ==========
    public function scopeOfShare($query, $lessonId)
    {
        return $query->where('lesson_id', $lessonId)->where('section', static::SECTION['read']);
    }

    // ============= field ==========
}